import os
try:
	import pygtk
	pygtk.require('2.0')
	import gtk
	import gtk.glade
except:
	print 'Install pygtk,libgtk2.0 and libglade2.0'
	os.exit(1)

class messageBox:
	def __init__(self, lbl_msg = 'Message here', dlg_title = '', glade='msgBox/msgbox.glade'):
		self.wTree = gtk.glade.XML(glade)
		self.dlg = self.wTree.get_widget('dialog1')
		self.lbl = self.wTree.get_widget('label1')
		self.dlg.set_title(dlg_title)
		self.lbl.set_text(lbl_msg)
		handlers = { 'on_okbutton1_clicked':self.done }
		self.wTree.signal_autoconnect( handlers )
		

	def done(self,w):
		self.dlg.destroy()



class test:	
	def __init__(self):
		self.window = gtk.glade.XML('./window.glade','window1')
		dic = { 'on_window1_delete' : gtk.main_quit,
			'on_button1_clicked' : self.sayHello }
		self.window.signal_autoconnect(dic)
	def sayHello(self,w):
		from msgBox import messageBox
		self.msg = messageBox('hi,there','hello, DaNmarner!', 'msgbox.glade')
	def quit(self,w):
		print "quit"	
		gtk.main_quit()

if __name__ == '__main__':
	test = test()
	#messageBox("coucou")
	gtk.main()
